# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=gammaray
pkgver=2.11.1
pkgrel=0
pkgdesc="A tool for examining the internals of a Qt application and to some extent also manipulate it"
url="https://www.kdab.com/development-resources/qt-tools/gammaray/"
arch="all !ppc64le !s390x !armhf !mips !mips64" # Limited by qt5-qtwebengine
license="GPL-2.0-or-later"
makedepends="cmake qt5-qtbase-dev qt5-qtwebengine-dev qt5-qtlocation-dev
	qt5-qtwayland-dev qt5-qttools-dev qt5-qtsvg-dev qt5-qtdeclarative-dev
	qt5-qtscript-dev qt5-qtconnectivity-dev syntax-highlighting-dev
	kcoreaddons-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/KDAB/GammaRay/releases/download/v$pkgver/gammaray-$pkgver.tar.gz
	qt-5-15-compatibility.patch
	"
options="!check" # No tests

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

package() {
	make DESTDIR="$pkgdir" install
	gzip "$pkgdir"/usr/share/man/man1/gammaray.1
}

sha512sums="d75b7ffa09f89439a94765307415543f47d8ac59bcea0ef4ba7987d3b8449b597f6664044d6a8e705c4978787f9f42201f90f1dc8daae58e880b082c96e3a7f9  gammaray-2.11.1.tar.gz
9fe6482b1bf80c3872abd8f16a29ab0d092a9c2d70b413dcc47a8bce630487865c7b44ff1cbc87a0ad349fb2516dfc64da5e80aec697b6591198b5ddba90d186  qt-5-15-compatibility.patch"
